home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Best of Shareware
/
Best of PC Windows Shareware 1.0 - Wayzata Technology (7111) (1993).iso
/
pc
/
dos
/
editors
/
marg281
/
marg.doc
< prev
next >
Wrap
Text File
|
1992-08-13
|
14KB
|
367 lines
MARGARINE Version 2.81
Copyright 1991,1992 by Chuck Steenburgh
OK, so why is this program called MARGARINE? Because it
"spreads" the MARGins of your text files!!
So much for bad humor...
If you evaluate alot of shareware programs (and I do), you
might be annoyed at how so many times the left margin of the
documentation file is in column 0, or there are no page breaks
or page numbers. When printing out the file, this can lead to
a really lopsided-looking document, especially if the right
margin is in the 60-70 column range. If you wanted to punch
holes in the document and put it into a binder, you would end
up punching out some of the text in the first few columns.
While several print utilities such as Norm Patriquin's PPRINT
(an excellent program, by the way) allow you to specify a left
margin while printing, they have several drawbacks:
a) if you select too large of a value for the left
margin, some lines will "overflow" onto the next
line. This, in turn, will screw up page formatting
and page lengths.
b) most of these programs take over your machine instead
of running in the background like DOS print. This can
be a real inconvenience when printing 200K+ documentation
files.
OK, so what's the point?
MARGARINE 2.81 is a very simple program I wrote to overcome
both of these problems. First, MARGARINE will scan your entire
document in order to find the longest single line. Based on
this length, it calculates how much of a "buffer" can be added
to each line in the file without pushing the right margin off
the edge of the screen/paper. MARGARINE will then add whatever
amount of "padding" you specify to the left margin of the doc-
ument and write the result to a new file. Optionally, MARGA-
RINE will add top and bottom margins and paginate your docu-
ment for you. The resulting document can then be printed from
the DOS command line (using PRINT.COM or PRINT.EXE) and will
have a nice left margin.
STARTING THE PROGRAM
To run the program, use the following syntax:
MARG infile [outfile] [/Cnnn] [/Tnn [/Bnn] [/P]] [/H]
infile -- This is the name of the file you would like to
modify. This is required. The file must be in the cur-
Page 1
rent directory.
outfile -- This is the name of the new file which will
be written, containing the changes made to the original
input file. If none is specified, the first two char-
acters of input file will be changed to "$" and this will
become the output file.
/Cnnn -- Set column width. Normally, MARGARINE assumes
you want a document with 80 columns. Use this switch to
specify an alternate width between 25 and 132 columns.
This will have an impact on how much space is available for
the insertion of a left margin. Replace nnn with the num-
ber of columns you desire. If you specify less than 25 or
more than 132 columns, the default of 80 columns will be
used.
/Tnn -- Set top margin. Replace nn with the number of
lines you would like for a top margin. This number must
be between 0 and 30.
/Bnn -- Set bottom margin. Replace nn with the number
of lines you would like for a bottom margin. This number
must also be between 0 and 30. If not specified, this will
become the same as the top margin. If you do not specify a
top margin, the bottom margin will always be zero and this
switch will be ignored.
/P -- Include page numbers. A page number will be added
to each page of the document. The page number will be cen-
tered on the bottom of each page, including the last. You
must have specified a bottom margin of at least two lines.
/H -- Help screen. A brief help screen will be displayed
when MARG is entered alone on the command line or in con-
junction with the /H switch. The DOS errorlevel is set to
1 when the /H switch is used.
The command line switches may be preceded by either the
"/" or "-" character and may be entered in any order. The
names of the input and output files MUST be the first and
second arguments entered on the command line, respectively,
and must be legal DOS file names. The only exception to this
is the /H switch which must be entered alone on the command
line with the "MARG" command.
Command Examples:
To add a left margin to the file TEST.DOC and write output
to the file $$ST.DOC:
MARG test.doc
Page 2
To add a left margin to the file TEST.DOC, write the output
to TEST.TXT, and use a column width of 96 (12 CPI Prestige):
MARG test.doc test.txt /c96
To add a left margin to the file TEST.DOC, with one-inch
top and bottom margins, and write output to the file $$ST.DOC:
MARG test.doc /t6
To add a left margin to the file TEST.DOC, write output to
TEST.TXT, with top margin of one inch and bottom margin of a
half inch, with page numbers and page width of 64 (8 CPI):
MARG test.doc test.txt /t6 /b3 /p /c64
Be careful! MARGARINE is not very intelligent, and it will
insert page breaks in some pretty silly places sometimes
(like in the middle of a table). For aesthetic purposes, you
may want to do some manual editing.
Upon entering the proper command to begin the program, you
will be shown a message displaying the amount of space avail-
able for the left margin. You will then be asked to enter the
value you actually want the program to use. The output file
will then be written. While the output file is being written,
a "gas gauge" will appear showing what percentage of the oper-
ation has been completed (see below):
0┬┬┬10┬┬┬20┬┬┬30┬┬┬40┬┬┬50┬┬┬60┬┬┬70┬┬┬80┬┬┬90┬┬┬100
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
Error Messages
The program can produce several error messages:
"Line length too long to add margin."
This message is printed if MARGARINE encounters a line in
your document that is longer than your specified column width.
If you have specified a top margin, execution of the program
continues and top, bottom, and/or page numbers will be added
normally. If you have not specified a top margin, the DOS
errorlevel is set to 4 and the program terminates.
"Incorrect number of parameters."
This message is printed when you do not enter any parameters
Page 3
on the command line, or enter too many parameters. The help
screen is displayed, the DOS errorlevel is set to 2, and the
program terminates.
"*** Can't open input text file ***"
This message is printed when the input file does not exist
or is not in the current directory. The DOS errorlevel is set
to 3 and the program terminates.
"*** Invalid entry. Enter number between 0 and n"
This message is printed if you enter a value for the left
margin that is too large or too small.
The DOS errorlevel is set to 0 upon successful termination
of the program.
The program is also useful for adding margins to your own
text file memos, letters, etc. For example, the simple editor
that I use does not support margins or pagination. I use
MARGARINE to add a left margin to improve the appearance of my
documents, and to add top and bottom margins for a more profes-
sional look. This document was formatted with MARGARINE 2.81
producing the wide left margin, page breaks, and page numbers
you see here.
REGISTRATION
This program is a copyrighted work. Many hours of effort
have gone into the creation of this program.
You have a limited license to operate this program on your
computer for a period of no more than 30 days free of charge.
If, after this trial period, you decide you would like to
continue using MARGARINE v2.81, you must register the program.
ANY OTHER USE OF THIS PROGRAM IS A VIOLATION OF COPYRIGHT LAWS.
To register the program, send $10 to the address at the end
of this documentation. Your registration fee gets you:
- The latest version of MARGARINE on disk
- Automatic shipment of version 3.0 on disk
- Shareware versions of my other programs
You are free to distribute MARGARINE to BBSs, shareware ven-
dors, etc., as long as you don't charge more than $5 for this
service and the COMPLETE MARGARINE archive is distributed.
Page 4
DISCLAIMER
This program is guaranteed to do absolutely NOTHING! It
does, however, in my experience perform reasonably close to
what is described herein. The author assumes no liability
for loss or damage caused through the use of this program.
Before trying the program, especially for the first time
or on any important text files, make a backup copy of the
text files you are planning to manipulate.
I welcome comments and suggestions from all. I may be
reached as indicated below:
Chuck Steenburgh CIS: 72330,1776
304A North Main
Lexington, VA 24450
(703)464-5290 evenings
I answer all phone calls, comments, and E-mail!
VERSION HISTORY
2.81 - 21 December 1991: Minor bug fix (damn those things!!)
2.8 - 20 December 1991: Finally got around to reconstruc-
ting the source code after my hard
disk crashed
Added "gas gauge"
Improved help screen
Allowed top/bottom/pagination when
line length was too large for
adding a left margin
Improved error tones
2.7 - 15 August 1991: Cleaned up command line interface
Added pagination option
Separate top and bottom margins
2.6 - 9 August 1991: Buffered I/O improves performance 100
2.51 - 18 July 1991: Minor bug fix
2.5 - 17 July 1991: Added support for top and bottom margins
2.1 - 31 May 1991: Added support for 25-132 column printers
2.0 - 16 May 1991: Added support for command line
specification of input/output files
Sounds tone on error
1.2 - 16 April 1991: Prevents overwriting existing
Page 5
output file
Allowed user control over margin width
1.1 - 14 April 1991: Added improved error handling
procedures
Allowed user control over output file
name
1.0 - 10 April 1991: Initial release
Page 6